const webpack = require("webpack");
const path = require("path");
const webpackBaseConfig = require("./webpack.common");
const merge = require("webpack-merge");
const utils = require("./utils");

module.exports = utils.pushHtmlWebpackPlugins(
  merge(webpackBaseConfig, {
    mode: "development",
    devtool: "cheap-module-eval-source-map",
    devServer: {
      contentBase: path.join(__dirname, "dist"),
      historyApiFallback: true,
      inline: true,
      hot: true,
      open: true,
      host: "192.168.6.222",
      proxy: {
        "/api": "http://localhost:3000",
      },
      before(_, server) {
        server._watch(__dirname + "/src/pages");
      },
    },
    plugins: [new webpack.HotModuleReplacementPlugin()],
  })
);
